package Demo1;
//移动零
public class Solution {
    public void moveZeroes(int[] nums) {
        int dest = -1;
        for(int cur = 0;cur < nums.length;cur++){
            if(nums[cur] != 0){
                swap(nums,cur,dest+1);
                dest++;
            }
        }
    }
    private void swap(int nums[],int cur,int dest){
        int tmp = nums[cur];
        nums[cur] = nums[dest];
        nums[dest] = tmp;
    }
}